"""
api为接口层，用于写接口函数
"""

from flask import Blueprint
from src.core import user_core
from src.utils.error_util import CoreException
from src.utils import api_util
import logging
from src.utils.token_util import token_verify

logger = logging.getLogger(__name__)
user = Blueprint('user', __name__, url_prefix='/user')

# 获取登录类型
@user.route('/login_type', methods=['GET'])
@token_verify
def login_type(current_user):
    try:
        login_type = user_core.get_login_type()
    except CoreException as e:
        return api_util.fail(error_msg=e.message, code=e.code)
    except Exception as e:
        return api_util.fail(error_msg=str(e), code="500")
    return api_util.success(data = {"login_type": login_type})

if __name__ == '__main__':
    print()